# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        黄周云  
# Name:         test06
# Description:  格式化日期和时间、时间戳的增量
# Author:       ASUS
# Date:         2019/3/30
#-------------------------------------------------------------------------------


import time
import locale
#当格式化字符串中有中文
locale.setlocale(locale.LC_CTYPE, 'chinese')
print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))
print(time.strftime("%Y年%m月%d日 %H时%M分%S秒", time.localtime()))
print(time.strftime('%Y{y}%m{m}%d{d} %H{H}%M{M}%S{S}').format(y='年', m='月', d='日',H='时', M='分', S='秒'))
print(time.strftime('今天是%A',time.localtime()))

time1 = time.time()
#当前时间戳往后移1分钟
time2 = time1+60
#当前时间戳往前移1小时
time3 = time1-60*60

time1 = time.localtime(time1)
time2 = time.localtime(time2)
time3 = time.localtime(time3)
print(time.strftime("%Y-%m-%d %H:%M:%S", time1))
print(time.strftime("%Y-%m-%d %H:%M:%S", time2))
print(time.strftime("%Y-%m-%d %H:%M:%S", time3))





